<template>
	<view>
	<!-- 	<view class="boxContent" v-for="(item,index) in violationDetails":key="index" @click="popToViolationDetail(item)">
			<view  class="header">
				<view class="box">学生姓名</view>
				<view class="box" style="font-weight: 700; font-size: 25rpx;">{{item.studentName}}</view>
			</view>
			<view style="width: 1rpx; height: 50rpx; background-color: #f1f1f1;"></view>
			<view class="header">
				<view class="box">违纪时间</view>
				<view class="box" style="font-weight: 700; font-size: 25rpx;">{{item.violationTime}}</view>
			</view>
			<view style="width: 1rpx; height: 50rpx; background-color: #f1f1f1;"></view>
			<view class="header">
				<view class="box">违纪内容</view>
				<view class="box" style="font-size: 20rpx;">{{item.note}}</view>
			</view>
		</view> -->
		<view>
		<uni-card style="padding-bottom: 10rpx;" v-for="(item,index) in violationDetails" :key="item.classId">
			<uni-row>
				<uni-col :span="16">
					<uni-row>
						<view style="line-height: 25px; display: flex; ">学生姓名：
							<view>{{item.studentName}}</view>
						</view>
					</uni-row>
					<uni-row>
						<view style="line-height: 25px; display: flex; ">违纪时间：
							<view style="color: #fe0000;" >{{item.violationTime}}</view>
						</view>
					</uni-row>
					<uni-row>
						<view style="line-height: 25px; ">违纪描述：
							<view style="color: #fe0000;" >{{item.note}}</view>
						</view>
					</uni-row>
					<uni-row>
						<view style="line-height: 25px; ">处理结果：
							<view style="color: #fe0000;" >{{item.handleContent}}</view>
						</view>
					</uni-row>
				</uni-col>
				<uni-col :span="8">
					<view style="margin: 20rpx">
						<image style="width: 180rpx; height: 250rpx;" :src="item.images" @click="imgClick(item.images)"></image>
					</view>
				</uni-col>
			</uni-row>
		</uni-card>
		</view>
		<view class="pic" v-if="violationDetails.length <= 0">
			<image src="https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/wujilu.png" mode="">
			</image>
		</view>
	</view>
</template>

<script>
	import violationPatrol from "../../api/modules/violationPatrol";
	import {parseTime} from "@/utils/date.js"
	export default {
		data() {
			return {
				startDate: "",
				endDate: "",
				classId: "",
				violationDetails: [],
				queryParam: {},
			}
		},
		methods: {
			//照片预览
			imgClick(url) {
				uni.previewImage({
					current: 0,
					urls: [url]
				})
			},
			getViolationsDetail() {
				var that = this
				console.log("getViolationsDetail")
				this.queryParam.startDate = this.startDate
				this.queryParam.endDate = this.endDate
				this.queryParam.classId = this.classId
				violationPatrol.getViolationPatrolStatisticsDetail(this.queryParam).then(res => {
					this.violationDetails = res.data
					
					this.violationDetails.forEach((item, index) => {
						item.createTime = parseTime(item.createTime)
						item.images = `${that.$baseAppUrl}common/downloadFileImg?filename=${item.images}`
						if(item.note == null || item.note === '') {
							item.note = '无'
						}
					})
					console.log(res)
				})
			}
		},
		onLoad(options) {
			this.startDate = options.startDate
			this.endDate = options.endDate
			this.classId = options.classId
			this.getViolationsDetail()
		}
	}
</script>

<style>
	.boxContent {
		background-color: #fff;
		border-radius: 20rpx;
		margin: 10rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx;
		text-align: center;
		border: 1px solid #a2a2a254;
		/* margin-top: 10rpx; */
	}
</style>
